import type { Request } from 'express'
import { groupService } from '@server/services/group-service'
import { ApiResponse } from '@data/api'

export default async function getGroupList(request: Request) {
  const includeDeleted = request.query.includeDeleted === 'true'
  const groups = await groupService.getGroups(includeDeleted)

  const response: ApiResponse = {
    success: true,
    data: groups,
  }

  return response
}
